package com.alageek.study;

import java.util.ArrayList;
import java.util.List;

public abstract class NumberGenerator {

    private final List<Observer> observers = new ArrayList<>();

    public void addObserver(Observer observer){
        observers.add(observer);
    }

    public void deleteObserver(Observer observer){
        observers.add(observer);
    }

    public void notifyObservers(){
        for(Observer observer:observers){
            observer.update(this);
        }
    }

    public abstract int getNumber();
    public abstract void execute();
}
